/** 
 * index.js
 * @author Ulyan Sobin
 * @description Index file for `cube` module
 */

"use strict";

module.exports.cube_info = {
	name: "Cube",
	version: "0.2.0",
};

const web = require("./cube-web");
module.exports.web = web;
module.exports.WebTree = web.WebTree;

const view = require("./view");
module.exports.view = view;

const { CubeServer } = require("./server");

/** 
 * @typedef {{
*   hostname: string,
*   port: number,
* }} HttpOptions
*/

/** 
* @typedef {{
*   hostname: string,
*   port: number,
*   cert: (string|ArrayBuffer),
*   key: (string|ArrayBuffer),
*   http_proxy: boolean
* }} HttpsOptions
*/

/**
* @typedef {{
*   hostname: string,
*   port: number
* }} WsOptions
*/

/**
* @typedef  {{
*   httpOptions: HttpOptions,
*   httpsOptions: HttpsOptions,
*   wsOptions: WsOptions,
*   handler: web.WebTree,
*   timeout: number
* }} ServerOptions
*/

/**
 * Create a cube server.
 * @param {ServerOptions} options
 */
function createServer(options) {
	return new CubeServer(options);
}
module.exports.createServer = createServer;

const resource = require("./resource");
module.exports.StaticFile = resource.StaticFile;
module.exports.StaticDirectory = resource.StaticDirectory;

const { WebFilter } = require("./filter");
module.exports.WebFilter = WebFilter;